package com.ngc.mall.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ngc.mall.common.configure.mybatisPlus.BaseServiceImpl;
import com.ngc.mall.domain.ArticleCategoryDomain;
import com.ngc.mall.mapper.ArticleCategoryMapper;
import com.ngc.mall.service.IArticleCategoryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * 文章分类实现类
 * @author: chenxiaolin
 * @date 2023/9/16 16:40
**/
@Service
public class ArticleCategoryServiceImpl extends BaseServiceImpl<ArticleCategoryMapper, ArticleCategoryDomain> implements IArticleCategoryService {

    @Override
    public List<ArticleCategoryDomain> selectAll() {
        return super.list();
    }

    @Override
    public Long createArticleCategory(ArticleCategoryDomain domain) {
        return super.create(domain);
    }

    @Override
    public Boolean updateById(Long id, ArticleCategoryDomain domain) {
        return super.update(domain, Wrappers.<ArticleCategoryDomain>lambdaQuery().eq(ArticleCategoryDomain::getId,id));
    }

    @Override
    public Boolean deleteById(Long id) {
        super.remove(Wrappers.<ArticleCategoryDomain>lambdaQuery().eq(ArticleCategoryDomain::getPid,id));
        return super.removeById(id);
    }
}
